$def with(info,head)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link href="$:config.static/style.css" rel="stylesheet" type="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>Chat Room</title>
<script type="text/javascript">
	function check(e)
	{
		if(!e)  
		{
			e = window.event;
		}
		if((e.keyCode || e.which) == 13)
		{
			sendmsg();
			return false;
		}
		else
			{
				return true;
			}
  }
  
window.onbeforeunload = function()
{
if (document.body.offsetWidth-50 < event.clientX && event.clientY<0)
return alert("hhhhhhh")
}

function Logout()
{
	alert("HH");
}
</script>
</head>
<body onload="updatemsg()">
<!--body -->
<script type="text/javascript">

function sendmsg()
 {
 var xmlHttp;
 var info;
 try
    {
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("No support AJAX");
         return false;
         }
      }
    }
/*
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
         document.myForm.time.value=xmlHttp.responseText;
        }
      }
*/
		info = document.myForm.msg.value;
    xmlHttp.open("POST","/update",true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    xmlHttp.send(info);
    xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4 && xmlHttp.status == 200)
    	{
    		document.bodyleft.innerHTML = xmlHttp.responseText;
    	}
    }
    document.myForm.msg.value='';
    document.myForm.msg.focus();
	
 };
 
 function getmsg()
 {
 var xmlHttp;
 try
    {
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("No support AJAX");
         return false;
         }
      }
    }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        	var objs = eval(xmlHttp.responseText);
        	var myhandle=document.getElementById("screentable");
        	var currentRows = myhandle.rows.length;
        	var insertTr = myhandle.insertRow(currentRows);
        	
        	var insertTd = insertTr.insertCell(0);
        	insertTd.innerHTML = objs[0].time;
        	insertTd = insertTr.insertCell(1);
        	insertTd.innerHTML = "<a href='####' onclick='addobject(this.innerHTML)'>"+objs[0].usr+"</a>";
        	insertTd = insertTr.insertCell(2);
        	insertTd.innerHTML = objs[0].msg;
        	/*
        	for(var i=0; i<3; ++i)
        	{
        		var insertTd = insertTr.insertCell(i);
        		insertTd.innerHTML = objs[0].time;
        	}
        	*/
          //document.getElementById("myscreen").innerHTML = xmlHttp.responseText;
        }
      }

    xmlHttp.open("GET","/update",true);	
    xmlHttp.send(null);
 }
 
 function updatemsg()
 {
 	var timer_update = setInterval("getmsg()",1000);
 }
 
 function addobject(usrname)
 {
 	var handler = document.getElementById("friendlist");
 	var optionlen = handler.options.length;
 	var flag=false;
 	for(var i=0; i<optionlen; ++i)
 	{
 		if(handler.options[i].value == usrname)
 		{
 			flag = true;
 			break;
 		}
 	}
 	if(flag == false)
 	{
 		handler.options.add(new Option(usrname,usrname));
 		handler.options[optionlen].selected = true;
 	}
 }
</script>

		<div class="container">
			<div class="headbox">
				<h1 align="center" style="padding-top:30px;">$head</h1>
			</div>
			<div class="bodybox">
				<div class="bodyleft" style="OVERFLOW:scroll;">
					<table id="screentable">
					</table>
				</div>
				<div class="bodyright">
					<p><b>Online Uses:</b></p><hr>
					<ul>
					</ul>
				</div>
			</div>
			<div class="input">
				<label width="20"><b>Object:</b></label>
				<select id="friendlist" size="1" align="left" >
					<option>All</option>
				</select>
				<br><br>
				<form method="post" name="myForm">
					<label width="20"><b>Message:</b></label>
					<input type="text" size="100" name="msg" onfocus="this.value=''" onkeydown="if(event.keyCode==13)sendmsg();" >
					<input type="button" value="submit" name="submit1" onclick="sendmsg();" >
					<input type="text" size="0" style="visibility:hidden;">
				</form>
			</div>
		</div>
	</body>
</html>